﻿using System;
using System.Collections.Generic;

namespace Sasa.QualityTools.CodeAnalysis.Common
{
    public static class Logger
    {
        private static readonly List<ILogger> loggers = new List<ILogger>();

        public static void Register(ILogger logger)
        {
            loggers.Add(logger);
        }

        public static void Clear()
        {
            loggers.Clear();
        }

        public static void Info(string format, params object[] args)
        {
            loggers.ForEach(logger => logger.Info(format, args));
        }

        public static void Warn(string format, params object[] args)
        {
            loggers.ForEach(logger => logger.Warn(format, args));
        }

        public static void Error(string format, params object[] args)
        {
            loggers.ForEach(logger => logger.Error(format, args));
        }

        public static void Error(Exception exception, string format, params object[] args)
        {
            loggers.ForEach(logger => logger.Error(exception, format, args));
        }
    }
}
